
export default{
	state: {
		userNews:uni.getStorageSync('userNews'),//用户信息
		likeObj:[],//用户点赞列表
		selectLikeObj:{},//当前点赞对象
	},
	getters: {
		//是否今日签到
		is_sign(state){
			return state.userNews.is_sign == 0 ? false : true
		},
	},
	mutations: {
		//同步
		//设置用户信息
		SET_USERNEWS(state,data){
			//data对象
			state.userNews = data
			uni.setStorageSync('userNews',data)
		},
		//存储用户点赞
		SAVE_SELECT_LIKEOBJ(state,data){
			//data对象
			state.selectLikeObj = data
			uni.setStorageSync('selectLikeObj',data)
		},
		//增加用户点赞
		ADD_LIKE(state,data){
			state.likeObjList.push(data)
			uni.setStorageSync('likeObjList',state.likeObjList)
		},
		//删除用户点赞
		DELETE_LIKE(state,data){
			const index = state.likeObjList.findindex(data)
			if(index > -1){
				state.likeObjList.splice(index,1)
				uni.setStorageSync('likeObjList',state.likeObjList)
			}
		},
	},
	actions: { 
		//异步
		
	}
}